#ifndef __BUZZER_H__
#define __BUZZER_H__

#include <stdio.h>

#define L_DO   220
#define L_RE   247
#define L_MI   277
#define L_FA   293
#define L_SO   330
#define L_LA   370
#define L_SI   415

#define M_DO   440
#define M_RE   494
#define M_MI   554
#define M_FA   587
#define M_SO   659
#define M_LA   740
#define M_SI   831

#define H_DO   880
#define H_RE   988
#define H_MI   1109
#define H_FA   1175
#define H_SO   1319
#define H_LA   1480
#define H_SI   1661

typedef struct {
    uint16_t freq;      // 音阶
    uint16_t duration;  // 时长ms
} note_t; // 一个音符

void init_buzzer(void);
void buzzer_out(uint8_t value);
void set_buzzer_volume(uint8_t volume);
uint8_t get_buzzer_volume(void);

#endif /* __BUZZER_H__ */
